//import { serializeStyles } from "../serialize";
import { Insertion } from '../utils';
/**
 * 这是emotion自己实现的React.createElement 生成React元素或说虚拟DOM的方法
 * @param {*} type 
 * @param {*} props 
 * @param  {...any} children 
 */
function jsx(type, props, ...children) {
  return (
    <Emotion {...props} type={type}>{children}</Emotion>
  )
}
function Emotion(props) {
  debugger
  //const serialized = serializeStyles(props.css);
  const serialized = props.css;
  const { css, ...newProps } = props;
  newProps.className = 'css-' + serialized.name;
  const WrappedComponent = props.type;//div
  return (
    <>
      <Insertion serialized={serialized} />
      <WrappedComponent {...newProps} />
    </>
  )
}
export default jsx;